<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//前台登陆
Route::get('/', function () {
    return view('home.login');
});
//前台退出
Route::get("index/logout", function(Illuminate\Http\Request $request){
    $request->session()->flush();
    return view("dispatch",["message"=>"退出成功","error"=>false, "waitSecond"=>1,"jumpUrl"=>url("index/index")]);
});
//后台退出
Route::get("admin/logout", function(Illuminate\Http\Request $request){
    $request->session()->flush();
    return view("dispatch",["message"=>"退出成功","error"=>false, "waitSecond"=>1,"jumpUrl"=>url("index/index")]);
});
//前台登陆
Route::post('index/dologin', "Home\IndexController@doLogin");
//前台
Route::group(['middleware'=>"auth.home"],function(){
    //系统首页
    Route::get("index/index","Home\IndexController@index");
    //会员网络
    Route::get("index/memrecommend","Home\IndexController@memrecommend");
    //新闻详情
    Route::get("index/newdetail/{id}","Home\IndexController@newDetail")->where(['id'=>"[\d]"]);
    //新闻中心
    Route::get("index/newcenter","Home\IndexController@newCenter");
    //收件箱
    Route::get("index/inbox","Home\IndexController@inBox");
    //发件箱
    Route::match(['post', 'get'],'index/sendbox',"Home\IndexController@sendBox");
    //验证二级密码
    Route::match(['post', 'get'], 'index/seclogin',"Home\IndexController@secLogin");
    Route::middleware('auth.secpwd')->group(function(){
        //用户信息
        Route::match(['post', 'get'],"index/userinfo","Home\IndexController@userInfo");
        //修改密码
        Route::match(['post','get'],'index/modpwd',"Home\IndexController@modpwd");
        //升级
        Route::match(['post','get'],'index/upgrade',"Home\IndexController@upgrade");
        //奖金明细
        Route::get('index/countmoneylog',"Home\IndexController@countMoneyLog");
        //奖金提现
        Route::match(['post','get'],'index/withdraw',"Home\IndexController@withdraw");
        //奖金币转电子币
        Route::match(['post','get'],'index/usertransfer',"Home\IndexController@userTransfer");
        //电子币互转
        Route::match(['post','get'],'index/dzbhz',"Home\IndexController@dzbhz");
        //电子币充值
        Route::match(['post','get'],'index/dzbcz',"Home\IndexController@dzbcz");
        //注册会员
        Route::match(['post','get'],'index/reguser',"Home\IndexController@reguser");
    });
});
